package cn.coder.toolkit;

import java.util.concurrent.TimeUnit;

public final class ThreadKit {

	private ThreadKit() {}

	public static class Sleep {

		public static void sleep(TimeUnit unit, long timeout) {
            try {
                unit.sleep(timeout);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

		public static void milli(long timeout) {
			sleep(TimeUnit.MILLISECONDS, timeout);
		}

		public static void second(long timeout) {
			sleep(TimeUnit.SECONDS, timeout);
		}

		public static void minute(long timeout) {
			sleep(TimeUnit.MINUTES, timeout);
		}

		public static void hour(long timeout) {
			sleep(TimeUnit.HOURS, timeout);
		}

		public static void day(long timeout) {
			sleep(TimeUnit.DAYS, timeout);
		}

	}

	public static String name() {
		return Thread.currentThread().getName();
	}

}
